﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace PropertyManagment.entity {

    /// <summary>
    /// 用户实体类
    /// </summary>
    [Table("sys_user")]
    public class SysUser : BaseEntity {

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime created { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? updated { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        [Required]
        public int statu { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage = "请输入姓名"), MaxLength(50, ErrorMessage = "名字的长度不能超过50个字符")]
        public String username { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [Required(ErrorMessage = "请输入密码"), MaxLength(50, ErrorMessage = "密码的长度不能超过50个字符")]
        public String password { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public String avatar { get; set; }

        /// <summary>
        /// 邮件
        /// </summary>
        public String email { get; set; }
        
        /// <summary>
        /// 电话
        /// </summary>
        public String phone { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        public String city { get; set; }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime? last_login { get; set; }

        /// <summary>
        /// 用户拥有的角色权限
        /// </summary>
        public List<SysRole> sysRoles = new List<SysRole>();
    }
}
